<?php

class GuestbookController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        $this->view->mystring = "lannn@tsdv.com.vn";
        // action body
        $guestbook = new Application_Model_GuestbookMapper();
        $this->view->entries = $guestbook->fetchAll();
    }

    public function signAction()
    {
        // action body
        $request = $this->getRequest();
	$form    = new Application_Form_Guestbook();

        $newacc = array('email'=>'campv@tsdv.com.vn', 'comment'=>'dskadjka');
	if ($this->getRequest()->isPost()) {
            if ($form->isValid($request->getPost())) {
                $newuser = new Application_Model_Guestbook();
                $newuser->setEmail($form->getValue('email'));
                $newuser->setComment($form->getValue('comment'));
                $mapper  = new Application_Model_GuestbookMapper();
                $mapper->save($newuser);
                return $this->_helper->redirector('index');
	    }
	}

        $this->view->form = $form;
    }


}





